$(document).ready(function () {
    getArrayByParam(1,2,null,null);
    localStorage.setItem(findRole,2);
    getDepArray();
    sho();
    // #(){
    //
    // }
})

function sho(){
    var user = localStorage.getItem(schoolLoginUserInfo);
    if (user == null) {
        toLogin();
    }
    var res = eval('(' + user + ')');
    if(res.role==2){
        $("#so").show()
    }
}

function serach() {
    var name = $("#serach").val();
    var department = $("#departmentId").val();
    var role = localStorage.getItem(findRole);
    getArrayByParam(1, role, name,department);
}

function scor(){
    window.location.href="scoreArray.html";
}

function getDepArray(){
    var dUrl = url+departmentArray;
    $.ajax({
        "url": dUrl,
        "type": 'get',
        "dataType": "json",
        "success": function (data) {
            var res = eval('(' + JSON.stringify(data) + ')');
            if (res.resultCode != 200) {
                error(data);
                return;
            }
            select(res.obj);
        },
        "error": error()
    })
}

function select(array){
    var se=""
    for (var i = 0; i < array.length; i++) {
        se+="<li><a href=\"#\" onclick=\"hid(this,"+array[i].id +")\">"+array[i].name+"</a></li>";
    }
    $("#ul").empty()
    $("#ul").append(se);
}

function hid(obj,va){
    $("#departmentId").val(va);
    $( "#dt").html($(obj).html());
    $("#dd").hide();
}
